﻿@model KL.Store.Web.Models.VoucherListModel
@using KL.Store.Core.Domain
@using (Ajax.BeginForm("Get", "Voucher", new { }, new AjaxOptions { UpdateTargetId = "voucherList", HttpMethod = "Post", LoadingElementId = "LoadingTotal" }, new { id = "frmRefresh", name = "frmRefresh" }))
{
    <div class="cart-info">
        <div class="shop-cart-voucher">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <td class="col-xs-1">
                        </td>
                        <td class="col-xs-4">
                            Hediye Çeki No
                        </td>
                        <td class="col-xs-3">
                            Tarih
                        </td>
                        <td class="col-xs-2">
                            Açıklama
                        </td>
                        <td class="col-xs-2 alignright">
                            Tutar
                        </td>
                    </tr>
                </thead>
                <tbody>
                    @for (int i = 0; i < Model.Vouchers.Count; i++)
                    {
                        <tr>
                            <td>
                                @Html.HiddenFor(model => model.Vouchers[i].VoucherId)
                                @Html.CheckBoxFor(model => model.Vouchers[i].Selected, new { onchange = "frmSubmit()" })
                            </td>
                            <td>@Model.Vouchers[i].VoucherId
                            </td>
                            <td>@Model.Vouchers[i].ValidDateStr
                            </td>
                            <td>@Model.Vouchers[i].Comment
                            </td>
                            <td style="text-align: right">@Model.Vouchers[i].Payment
                            </td>
                        </tr>
                    }
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="4" style="text-align: right">
                            Toplam @(Model.Vouchers.Count)
                            Adet
                        </td>
                        <td style="text-align: right">@(Model.SelectedVoucherSum.ToString("###,##0.00"))
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>
    <br />
    <br />
    <div>
        @if (Model.SelectedVoucherSum > 0)
        {
            <table border="0px">
                <tr>
                    <td style="width: 75px">
                        Eposta
                    </td>
                    <td>@Html.TextBoxFor(m => m.Email, new { @class = "medium" })
                    </td>
                </tr>
                @if (Model.DetailInfoNeeded)
                { 
                    <tr>
                        <td>
                            Ad Soyad
                        </td>
                        <td>@Html.TextBoxFor(m => m.FirstName) @Html.TextBoxFor(m => m.LastName)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Telefon
                        </td>
                        <td>@Html.TextBoxFor(m => m.Phone)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Mobil
                        </td>
                        <td>@Html.TextBoxFor(m => m.Mobile)
                        </td>
                    </tr>
                }
                <tr>
                    <td>
                    </td>
                    <td>
                        <input id="button" name="button" class="button" type="submit" value="Hediye Çeki Gönder" />
                    </td>
                </tr>
            </table>
        }
    </div>
    @Html.Raw(Model.ProcessMessage)
    <div>
    </div>

}
<script type="text/javascript">
    function frmSubmit() {
        $('#frmRefresh').submit();
    }
</script>
